package com.whl.project.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.whl.project.model.PermissionResult;
import com.whl.project.service.PermissionService;

@Controller
@RequestMapping("/permission")
public class PermissionController {

	@Autowired
	private PermissionService permissionService;

	@RequestMapping(value = "/anonymous", method = RequestMethod.GET)
	public List<PermissionResult> anonymous() {
		List<PermissionResult> results = permissionService.findByNoLogin();
		return results;
	}

	@RequestMapping(value = "/authority", method = RequestMethod.GET)
	public List<PermissionResult> authority() {
		List<PermissionResult> results = permissionService.findByGrant();
		return results;
	}

	@RequestMapping(value = "/find-user-id", method = RequestMethod.GET)
	public List<String> findByUserId(@RequestParam Long userId) {
		List<String> results = permissionService.findByUserId(userId);
		return results;
	}

}
